package com.wang.service.impl;

import com.wang.a.UserProfileFeign;
import com.wang.dao.GoodsOrderMapper;
import com.wang.domain.GoodsOrder;
import com.wang.dto.UserProfileDTO;
import com.wang.service.IGoodsOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author wangyandong
 * @date 2020/2/1 11:29
 */
@Service
public class GoodsOrderServiceImpl implements IGoodsOrderService {

    @Autowired
    private GoodsOrderMapper goodsOrderMapper;

    @Autowired
    private UserProfileFeign userProfileFeign;

    @Override
    public GoodsOrder getById(Integer id) {
        if (id == null){
            return null;
        }
        GoodsOrder goodsOrder = goodsOrderMapper.selectByPrimaryKey(id);
        if(goodsOrder != null && goodsOrder.getUserId() != null){
            UserProfileDTO userProfileDTO = userProfileFeign.getById(goodsOrder.getUserId());
        }
        return goodsOrder;
    }
}
